// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
const projectName = 'jiadx-app'
// 注意：这个配置是区分当前运行的项目底座是APP还是微信。如果是APP则为true，否则为false。这个配置会影响debug和prod模式下的内部静态资源加载路径和混淆代码中混淆的第三方模块集合
const deployInApp = true

module.exports = {
  projectName: projectName,
  deployInApp: deployInApp,
  manifestName: 'manifest_' + projectName,
  vendorName: 'vendor_' + projectName,
  imgName: 'img_' + projectName,
  dev: {
    // Paths

    // assetsSubDirectory: 'static',
    assetsSubDirectory: deployInApp ? 'static' : 'static-wechat',
    assetsPublicPath: '/',
    // http://222.185.255.10:37090/CZBus/V3.0/Bus/GetList?Line_Id=8&Line_Type=1
    proxyTable: {
      '/api': {
        // target: 'http://222.185.255.10:37090/CZBus/V3.0/', // 设置你调用的接口域名和端口号
        target: 'http://jdqczhjc.cn/index.php/', // 设置你调用的接口域名和端口号
        changeOrigin: true, // 跨域
        pathRewrite: {
          '^/api': '/' // 这里理解成用‘/api’代替target里面的地址，后面组件中我们掉接口时直接用api代替 比如我要调用'http://10.1.5.11:8080/xxx/duty?time=2017-07-07 14:57:22'，直接写‘/api/xxx/duty?time=2017-07-07 14:57:22’即可
        }
      }
    },

    // Various Dev Server settings
    // host: '192.168.1.16', // can be overwritten by process.env.HOST
    // host: '192.168.1.38', // can be overwritten by process.env.HOST
    // host: '192.168.1.38', // can be overwritten by process.env.HOST
    host: 'localhost',
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: true,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: 'cheap-module-eval-source-map',

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    cssSourceMap: false
  },

  build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: './',
    // assetsSubDirectory: deployInApp?'static':'static-wechat',
    assetsPublicPath: './',

    /**
     * Source Maps
     */

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: '#source-map',

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}
